package com.ruoyi.quality.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualityMaterialMapper;
import com.ruoyi.quality.domain.QualityMaterial;
import com.ruoyi.quality.service.IQualityMaterialService;

/**
 * 物料管理Service业务层处理
 * 
 * @author wky
 * @date 2024-06-05
 */
@Service
public class QualityMaterialServiceImpl implements IQualityMaterialService 
{
    @Autowired
    private QualityMaterialMapper qualityMaterialMapper;

    /**
     * 查询物料管理
     * 
     * @param materialId 物料管理主键
     * @return 物料管理
     */
    @Override
    public QualityMaterial selectQualityMaterialByMaterialId(Long materialId)
    {
        return qualityMaterialMapper.selectQualityMaterialByMaterialId(materialId);
    }

    /**
     * 查询物料管理列表
     * 
     * @param qualityMaterial 物料管理
     * @return 物料管理
     */
    @Override
    public List<QualityMaterial> selectQualityMaterialList(QualityMaterial qualityMaterial)
    {
        return qualityMaterialMapper.selectQualityMaterialList(qualityMaterial);
    }

    /**
     * 新增物料管理
     * 
     * @param qualityMaterial 物料管理
     * @return 结果
     */
    @Override
    public int insertQualityMaterial(QualityMaterial qualityMaterial)
    {
        qualityMaterial.setCreateTime(DateUtils.getNowDate());
        return qualityMaterialMapper.insertQualityMaterial(qualityMaterial);
    }

    /**
     * 修改物料管理
     * 
     * @param qualityMaterial 物料管理
     * @return 结果
     */
    @Override
    public int updateQualityMaterial(QualityMaterial qualityMaterial)
    {
        return qualityMaterialMapper.updateQualityMaterial(qualityMaterial);
    }

    /**
     * 批量删除物料管理
     * 
     * @param materialIds 需要删除的物料管理主键
     * @return 结果
     */
    @Override
    public int deleteQualityMaterialByMaterialIds(Long[] materialIds)
    {
        return qualityMaterialMapper.deleteQualityMaterialByMaterialIds(materialIds);
    }

    /**
     * 删除物料管理信息
     * 
     * @param materialId 物料管理主键
     * @return 结果
     */
    @Override
    public int deleteQualityMaterialByMaterialId(Long materialId)
    {
        return qualityMaterialMapper.deleteQualityMaterialByMaterialId(materialId);
    }
}
